//
//  AnotherTableViewCell.m
//  WangI
//
//  Created by 刘珊珊 on 15/11/25.
//  Copyright (c) 2015年 刘珊珊. All rights reserved.
//

#import "AnotherTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation AnotherTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _imageV1 = [[UIImageView alloc]init];
//        _imageV1.backgroundColor = [UIColor redColor];
        
        _imageV2 = [[UIImageView alloc]init];
//        _imageV2.backgroundColor = [UIColor redColor];
        
        _imageV3 = [[UIImageView alloc]init];
//        _imageV3.backgroundColor = [UIColor redColor];
        
        _titltLabel = [[UILabel alloc]init];
//                _titltLabel.backgroundColor = [UIColor grayColor];
        _titltLabel.font = [UIFont systemFontOfSize:20];
            
        _replyCountLabel = [[UILabel alloc]init];
        _replyCountLabel.font = [UIFont systemFontOfSize:15];
//                _replyCountLabel.backgroundColor = [UIColor blueColor];
        
        [self addSubview:self.imageV1];
        [self addSubview:self.imageV2];
        [self addSubview:self.imageV3];
        [self addSubview:self.titltLabel];
        [self addSubview:self.replyCountLabel];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _imageV1.frame = CGRectMake(10, 30, 110, 80);
    _imageV2.frame = CGRectMake(130, 30, 110, 80);
    _imageV3.frame = CGRectMake(250, 30, 110, 80);
    _titltLabel.frame = CGRectMake(10, 0, self.frame.size.width - 60, 30);
    _replyCountLabel.frame = CGRectMake(self.frame.size.width - 70, 0, 70, 30);
}

-(void)setHeadModel:(HeadlineModel *)headModel{
    if (_headModel != headModel) {
        [_headModel release];
        _headModel = [headModel retain];
    }
    [self.imageV1 sd_setImageWithURL:[NSURL URLWithString:headModel.imgsrc]];
    [self.imageV2 sd_setImageWithURL:[NSURL URLWithString:[headModel.dataSource1[0]valueForKey:@"imgsrc"]]];
    [self.imageV3 sd_setImageWithURL:[NSURL URLWithString:[headModel.dataSource1[1]valueForKey:@"imgsrc"]]];
    self.titltLabel.text = headModel.title;
    self.replyCountLabel.text = [NSString stringWithFormat:@"%ld",[headModel.replyCount integerValue]];;
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
